package com.example.springbootdemo;

public class ThreadDemo02 implements Runnable {
    public void run() {
        System.out.println(Thread.currentThread().getName() + ",我是子线程");
    }

    public static void main(String[] args) {
        // 1. 普通
        new Thread(new ThreadDemo02()).start();

        // 2.使用匿名内部类创建线程
        new Thread(new Runnable() {
            public void run() {
                System.out.println(Thread.currentThread().getName() + ",>我是子线程<");
            }
        }).start();

        // 2.lambda表达式创建线程
        new Thread(()-> System.out.println(Thread.currentThread().getName() + ",>我是子线程<"),"").start();
    }
}